#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int cmp_big(const void* e1, const void* e2)
{
    return *((int*)e1) - *((int*)e2);
}
void swap(char* b1, char* b2, int width)
{
    int i;
    for (i = 0; i < width; i++)
    {
        char tmp = *b1;
        *b1 = *b2;
        *b2 = tmp;
        b1++;
        b2++;
    }
}
void bsort(void* base, int sz, int width, int (*cmp)(const void* e1, const void* e2))
{
    int i, j;
    for (i = 0; i < sz; i++)
    {

        for (j = 0; j < sz - 1 - i; j++)
        {
            if (cmp((char*)base + j * width, (char*)base + (j + 1) * width) > 0)
            {
                swap((char*)base + j * width, (char*)base + (j + 1) * width, width);
            }
        }
    }
}
void test1()
{
    int arr[] = { 9,8,7,6,5,4,3,2,1,0 };
    bsort(arr, 10, 4, cmp_big);
    int i;
    for (i = 0; i < 10; i++)
    {
        printf("%d ", arr[i]);
    }

}
int main()
{
    test1();
    return 0;
}